﻿using System;
using System.Windows.Forms;
using ChinaDynastyTours.Controls;
using System.Data;

namespace ChinaDynastyTours.Views
{
    public partial class CitySelectedToolForm : Form
    {
        //输出参数
        //private DataTable _dtCityData;
        public string ReturnCityName { get; set; }

        public CitySelectedToolForm()
        {
            InitializeComponent();
        }

        private void LoadData()
        {
            cityGridControl.DataSource = BaseInfoCtrl.GetCityData(tbCityName.Text);
        }

        private void HotelProviderForm_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (cityGridView.DataRowCount > 0)
            {
                ReturnCityName = cityGridView.GetDataRow(cityGridView.FocusedRowHandle)["Name"].ToString();
            }
        }

        private void tbCityName_TextChanged(object sender, EventArgs e)
        {
            LoadData();
        }

        private void cityGridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            if (e.Clicks == 2)
                btnOk.PerformClick();
        }

    }
}
